<template>
  <div>
    <StudentInfo  :key="idx" v-for="student,idx in list" :name="student.name" :age="student.age" :sex="student.sex"></StudentInfo>

  </div>
</template>

<script>
import StudentInfo from './StudentInfo.vue'
import axios from 'axios'
export default {
    data() {
        return {
            list: []
        };
    },
    mounted() {
        console.log("获取数据");
        axios.get('http://localhost:8080/demo/api/student').then((res)=>{
            console.log(res.data);
            this.list=res.data
        }).catch((err)=>{
            console.log(err.message);
        })
    },
    components: { StudentInfo }
}
</script>

<style scoped>

</style>